package com.qfjy.zhaohongyan.controller;

import com.qfjy.zhaohongyan.service.ZhyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("zhy")
public class zhyController {

    @Autowired
    private ZhyService zhyService;
    @RequestMapping("phone")
    public String phone() {
        return "index.html";
    }

    @GetMapping("code")
    @ResponseBody
    public String getCode(String phone){
        String msg = "提交成功了";
        zhyService.code(phone);
         return msg;
    }

    @GetMapping("login")
    @ResponseBody
    public String login(String phone,String Msg){
        String msg = "";
        boolean b = zhyService.login(phone, Msg);
        if (b) {
            msg = "登录成功了";
        }else {
            msg ="失败";
        }
        return msg;
    }


}
